package com.xuetang9.t9.hotel.mapper;

import com.xuetang9.t9.hotel.beans.RolePermission;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface IPositionMapper {
    @Select("select * from role_permission")
    List<RolePermission> queryRoleList();
    @Select("select * from role_permission group by displayname")
    List<RolePermission> queryTankList();

    @Insert("insert role_permission(name, displayname, requrl, description) VALUES (#{name},#{displayname},#{requrl},#{description});")
    int insertRole(@Param("name")String name,@Param("displayname")String displayname,@Param("requrl")String url,@Param("description")String desc);

    @Update("update role_permission set name=#{name},displayname=#{displayname},requrl=#{requrl},description=#{description} where id=#{id}")
    int updateRole(@Param("id")long id,@Param("name")String name,@Param("displayname")String displayname,@Param("requrl")String url,@Param("description")String desc);

    @Delete("delete from role_permission where id=#{id}")
    int deleteRole(@Param("id") int id);

    @Select("select * from role_permission where id = #{id}")
    RolePermission queryOne(@Param("id") int id);

    @Select("select * from role_permission where displayname = #{name}")
    List<RolePermission> queryByName(@Param("name") String name);
}
